/**
 *
 * @author 
 *
 */
class Plane {
    //血量
    public blood: number;
    //飞机对象
    public Image: egret.Bitmap;
    //X轴
    public X: number;
    //Y轴
    public Y: number;
    //子弹类型
    public Type: string;
    //子弹声音
    public bulletSound: egret.Sound;
    //子弹模型
    public bulletImage: string;
    public main: Main;
    //开枪

    public constructor(main: Main) {
        this.main = main;
    }
    public diShoot(): Bullet {
        var buleplane = new Blueplane(this.main);
        var plane = buleplane.init;
        var bullet: Bullet = new Bullet();
        bullet.Type = "Donw";//子弹类==飞机类
        bullet.Image = new egret.Bitmap(RES.getRes(this.bulletImage));
        bullet.Image.width = 64;
        bullet.Image.height = 64;
        bullet.Plane = this;
        {
            bullet.bulletSound = this.bulletSound;
            bullet.Image.rotation = 360;
            //this.bullet.rotation=180;
            bullet.X = this.X - 55;
            bullet.Y = this.Y - 45;
        }
        bullet.Image.x = bullet.X;
        bullet.Image.y = bullet.Y;
        return bullet;
    };
    public Shoot(): Bullet {
        var buleplane = new Blueplane(this.main);
        var plane = buleplane.init;
        var bullet: Bullet = new Bullet();

        bullet.Type = this.Type;//子弹类==飞机类
        bullet.Image = new egret.Bitmap(RES.getRes(this.bulletImage));
        bullet.Image.width = 64;
        bullet.Image.height = 64;
        bullet.Plane = this;
        {
            bullet.bulletSound = this.bulletSound;
            bullet.Image.rotation = 360;
            //this.bullet.rotation=180;
            bullet.X = this.X - 30;
            bullet.Y = this.Y - 45;
        }
        bullet.Image.x = bullet.X;
        bullet.Image.y = bullet.Y;
        return bullet;
    };
   
    public Shoot2(): Bullet {
        var buleplane = new Blueplane(this.main);
        var plane = buleplane.init;
        var bullet: Bullet = new Bullet();
        bullet.Type = "down";//子弹类==飞机类
        bullet.Image = new egret.Bitmap(RES.getRes("bull_png"));
        bullet.Image.width = 64;
        bullet.Image.height = 64;
        bullet.Plane = this;
        {
            bullet.bulletSound = this.bulletSound;
            bullet.Image.rotation = 180;
            //this.bullet.rotation=180;
            bullet.X = this.X + 32;
            bullet.Y = this.Y + 40;
        }
        bullet.Image.x = bullet.X;
        bullet.Image.y = bullet.Y;
        return bullet;
    };
    public Shoot3(): Bullet {
        var buleplane = new Blueplane(this.main);
        var plane = buleplane.init;
        var bullet: Bullet = new Bullet();
        bullet.Type = "left";//子弹类==飞机类
        bullet.Image = new egret.Bitmap(RES.getRes("bull_png"));
        bullet.Image.width = 64;
        bullet.Image.height = 64;
        bullet.Plane = this;
        {
            bullet.bulletSound = this.bulletSound;
            bullet.Image.rotation = -90;
            //this.bullet.rotation=180;
            bullet.X = this.X - 30;
            bullet.Y = this.Y + 30;
        }
        bullet.Image.x = bullet.X;
        bullet.Image.y = bullet.Y;
        return bullet;
    };
    public Shoot4(): Bullet {
        var buleplane = new Blueplane(this.main);
        var plane = buleplane.init;
        var bullet: Bullet = new Bullet();
        bullet.Type = "righ";//子弹类==飞机类
        bullet.Image = new egret.Bitmap(RES.getRes("bull_png"));
        bullet.Image.width = 64;
        bullet.Image.height = 64;
        bullet.Plane = this;
        {
            bullet.bulletSound = this.bulletSound;
            bullet.Image.rotation = 90;
            //this.bullet.rotation=180;
            bullet.X = this.X + 30;
            bullet.Y = this.Y - 32;
        }
        bullet.Image.x = bullet.X;
        bullet.Image.y = bullet.Y;
        return bullet;
    };
    //硬币
    public lives: number;

}
